package com.jar.exercise.深拷贝和浅拷贝;

/**
 * 测试
 */
public class Demo {
	public static void main(String[] args) throws CloneNotSupportedException {
		Student student = new Student();
		student.setAge(18);
		student.setName("张胜豪");
		Student student1 = (Student) student.clone();
		System.out.println(student == student1);
		System.out.println(student1.getAge() + "---" + student1.getName());
	}
}

class Student implements Cloneable {

	private String name;
	private int age;

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getAge() {
		return age;
	}

	public void setAge(int age) {
		this.age = age;
	}

	@Override
	public Object clone() throws CloneNotSupportedException {
		return super.clone();
	}

}
